package jinyilw.tools.net.dev;

public final class NetworkConfig
{

	public static boolean DEBUG = false;

	private static PacketManager packetManager = new PacketManager();

	private static boolean autoConsumed = true;

	private static boolean defaultCompressed = true;
	private static int defaultPingTime = 6000;
	private static boolean defaultSendCode = false;
	private static boolean defaultSendSender = false;
	private static int defaultExpiredTime = 10000;
	private NetworkConfig()
	{
	}

	public static PacketManager getPacketManager()
	{
		return NetworkConfig.packetManager;
	}

	public static void setPacketManager(PacketManager manager)
	{
		NetworkConfig.packetManager = manager;
	}

	public static void registerPacket(short id, Class<?> packetClass)
	{
		NetworkConfig.packetManager.registerPacket(id, packetClass);
	}

	public static void registerPacket(short id, NetworkPacket packet)
	{
		NetworkConfig.packetManager.registerPacket(id, packet);
	}

	public static void registerPacket(short id, Class<?> type, String description)
	{
		NetworkConfig.packetManager.registerPacket(id,
				new NetworkObject(id, type).setDescription(description));
	}

	public static void registerPacket(short id, String description)
	{
		NetworkConfig.packetManager.registerPacket(id,
				new NetworkObject(id).setDescription(description));
	}

	public static boolean isDefaultCompressed()
	{
		return NetworkConfig.defaultCompressed;
	}

	public static void setDefaultCompressed(boolean compressed)
	{
		NetworkConfig.defaultCompressed = compressed;
	}

	public static int getDefaultPingTime()
	{
		return NetworkConfig.defaultPingTime;
	}

	public static void setDefaultPingTime(int aDefaultPingTime)
	{
		NetworkConfig.defaultPingTime = aDefaultPingTime;
	}

	public static boolean isDefaultSendCode()
	{
		return NetworkConfig.defaultSendCode;
	}

	public static void setDefaultSendCode(boolean aDefaultSendCode)
	{
		NetworkConfig.defaultSendCode = aDefaultSendCode;
	}

	public static boolean isDefaultSendSender()
	{
		return NetworkConfig.defaultSendSender;
	}

	public static void setDefaultSendSender(boolean aDefaultSendSender)
	{
		NetworkConfig.defaultSendSender = aDefaultSendSender;
	}

	public static boolean isAutoConsumed()
	{
		return NetworkConfig.autoConsumed;
	}

	public static void setAutoConsumed(boolean aAutoConsumed)
	{
		NetworkConfig.autoConsumed = aAutoConsumed;
	}

	public static int getDefaultExpiredTime()
	{
		return NetworkConfig.defaultExpiredTime;
	}

	public static void setDefaultExpiredTime(int aDefaultExpiredTime)
	{
		NetworkConfig.defaultExpiredTime = aDefaultExpiredTime;
	}
}
